home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_q_t / trem.zip / EVENT.C < prev    next >
Text File  |  1991-05-11  |  2KB  |  60 lines

  1. /************************************************************************
  2.  *
  3.  *    Copyright (c) 1991 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *-----------------------------------------------------------------------
  6.  *
  7.  *     Project:  Windows Terminal Example
  8.  *
  9.  *      Module:  event.c
  10.  *
  11.  *      Author:  Bryan A. Woodruff (baw)
  12.  *
  13.  *
  14.  *     Remarks:  This handles the RX_CHAR event on received characters
  15.  *
  16.  *   Revisions:  
  17.  *     01.00.000  5/10/91 baw   Wrote it.
  18.  *
  19.  ************************************************************************/
  20.  
  21. #include "terminal.h"
  22.  
  23. /************************************************************************
  24.  *  BOOL ProcessRxEvent( HWND hWnd, WORD wParam, LONG lParam )
  25.  *
  26.  *  Description: 
  27.  *     Processes an EV_RXCHAR event for the COM port.
  28.  *
  29.  *  Comments:
  30.  *      5/10/91  baw  Wrote it
  31.  *
  32.  ************************************************************************/
  33.  
  34. BOOL ProcessRxEvent( HWND hWnd, WORD wParam, LONG lParam )
  35. {
  36.    int          nLength ;
  37.    BYTE         abIn[ MAXBLOCK + 1] ;
  38.    LOCALHANDLE  hTermInfo ;
  39.    NPTERMINFO   npTermInfo ;
  40.  
  41.    hTermInfo = GetWindowWord( hWnd, GWW_TERMINFO ) ;
  42.    if (NULL == (npTermInfo = (NPTERMINFO) LocalLock( hTermInfo )))
  43.       return ( FALSE ) ;
  44.  
  45.    ClearEvent( hWnd, npTermInfo -> nCid, EV_RXCHAR ) ;
  46.    nLength = ReadCommBlock( hWnd, (LPSTR) abIn, MAXBLOCK ) ;
  47.  
  48.    if (nLength > 0)
  49.       WriteTerminalBlock( hWnd, (LPSTR) abIn, nLength ) ;
  50.  
  51.    LocalUnlock( hTermInfo ) ;
  52.    return ( TRUE ) ;
  53.  
  54. } /* end of ProcessRxEvent() */
  55.  
  56. /************************************************************************
  57.  * End of File: event.c
  58.  ************************************************************************/
  59.  
  60.